#!/bin/sh
source func_archive_app.sh

echo "start"

CURDIR=$(cd "$(dirname "$0")"; pwd)



echo cur:$CURDIR




#1:dir
#2:workspace name
#3:scheme
#4:debug/ad_hoc/enter
#同级目录 package/archive/[time]/, package/ipa/[time]/
#4:package file
#5:ipa file
WSDIR=${CURDIR}/..
WSNAME=${WSDIR}/Drop.xcworkspace
SCHEME=Drop
CONFIG=$1

PODSDIR=$WSDIR/Pods

if [ -d "${PODSDIR}" ]
then
pod install --no-repo-update
else
pod update --no-repo-update
fi

func_archive_app $WSDIR $WSNAME $SCHEME $CONFIG

#SOURCE_IPA_PATH=${CIRCLE_DIR}/Packages/IPA/Andes/Andes/Andes.ipa
#TARGET_IPA_PATH=${CIRCLE_DIR}/Packages/IPA/Andes/Andes.ipa
#rm -rf ${TARGET_IPA_PATH}
#cp "${SOURCE_IPA_PATH}" "${TARGET_IPA_PATH}"

cd $CUR_DIR

echo "end"

